/**
 * Copyright 2005 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.edi.db;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;

import com.edi.db.table.TableEntity;

public interface Session {
	public void close();

	public Boolean isOpen();

	public TableEntity queryEql(String eql, Integer start, Integer pageSize)
			throws SQLException;

	public TableEntity queryEql(String eql) throws SQLException;

	public int executeEql(String eql) throws SQLException;

	public TableEntity querySql(String sql, Integer start, Integer pageSize)
			throws SQLException;

	public TableEntity querySql(String sql) throws SQLException;

	public int excuteSql(String sql) throws SQLException;

	//	public void setParameter(int index,Object value);
	public int save(TableEntity tableEntity) throws SQLException;

	public int update(TableEntity tableEntity) throws SQLException;

	public int delete(TableEntity tableEntity) throws SQLException;

	public void setTransaction() throws SQLException;

	public void commit() throws SQLException;

	public void beginTransaction() throws SQLException;

	public void rollbackTransaction() throws SQLException;

	public void createTable(TableEntity tableEntity) throws SQLException;

	public boolean hasTable(String tableName) throws SQLException;

	public void createBaseTable(TableEntity tableEntity) throws SQLException;

	public void executePreparedEql(PreparedEql preparedEql) throws SQLException;

	public TableEntity queryPreparedEql(PreparedEql preparedEql)
			throws SQLException;

	/**
	 * 执行无返回结果集的存储过程
	 * 
	 * @param proc
	 * @throws SQLException
	 */
	public Map<Integer, Object> executeProc(EdiCallableStatement proc)
			throws SQLException;

	/**
	 * 执行具有返回结果集和输出参数的存储过程
	 * 
	 * @param proc
	 * @return
	 * @throws SQLException
	 */
	public TableEntity queryProc(EdiCallableStatement proc,
			Map<Integer, Object> outParamValues) throws SQLException;

	/**
	 * 执行具有返回结果记得存储过程
	 * 
	 * @param proc
	 * @return
	 * @throws SQLException
	 */
	public TableEntity queryProc(EdiCallableStatement proc) throws SQLException;

	public Connection getConnection();

}
